package com.fxp.project.jiuselu.web.models.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.fxp.project.jiuselu.web.business.v1.request.order.*;
import com.fxp.project.jiuselu.web.models.order.entity.JslOrder;
import com.fxp.project.jiuselu.web.models.order.vo.JslOrderArrearsVo;
import com.fxp.project.jiuselu.web.models.order.vo.JslOrderVo;
import com.fxp.project.jiuselu.web.models.order.vo.UserOrderPageVo;
import com.github.pagehelper.PageInfo;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 订单表 服务类
 * </p>
 *
 * @author Jason.Wang
 * @since 2021-11-17
 */
public interface IJslOrderService extends IService<JslOrder> {

    /**
     * saveUserOrderByUserId:保存当前用户的订单信息<br/>
     *
     * @param reqOrderCart
     * @param userId
     * @return
     * @author Kai.Wang
     * @date 2021/11/18 11:28
     */
    Object saveUserOrderByUserId(ReqOrderCart reqOrderCart, Long userId);

    /**
     * saveUserQuicklyOrderByUserId: 用户选择立即下单的操作<br/>
     *
     * @param reqOrderQuickly
     * @param userId
     * @return
     * @author Kai.Wang
     * @date 2021/11/22 13:55
     */
    Object saveUserQuicklyOrderByUserId(ReqOrderQuickly reqOrderQuickly, Long userId);

    /**
     * selectJslOrderVoByUserId: 查询当前的订单信息<br/>
     *
     * @param currentPage
     * @param pageSize
     * @param currentDate
     * @param userId
     * @return
     * @author Kai.Wang
     * @date 2021/11/24 15:31
     */
    PageInfo<?> selectJslOrderVoByUserId(Integer currentPage, Integer pageSize, LocalDateTime currentDate, Long userId,int orderTotalStatus);


    /**
     * selectJslOrderVoByUserId: 查询当前没开票的订单信息<br/>
     *
     * @param currentPage
     * @param pageSize
     * @param currentDate
     * @param userId
     * @return
     * @author Kai.Wang
     * @date 2021/11/24 15:31
     */
    PageInfo<?> selectFareJslOrderVoByUserId(Integer currentPage, Integer pageSize, LocalDateTime currentDate, Long userId,int orderTotalStatus);

    /**
     * selectJslOrderArrearsVoByUserId: 查询用户的预定订单信息<br/>
     *
     * @param currentPage
     * @param pageSize
     * @param currentDate
     * @param userId
     * @return
     * @author Kai.Wang
     * @date 2021/11/24 16:52
     */
    PageInfo<?> selectJslOrderArrearsVoByUserId(Integer currentPage, Integer pageSize, LocalDateTime currentDate, Long userId,int orderTotalStatus);

    /**
     * 查询预定订单
     * @param userId
     * @param addTime
     * @param orderTotalStatus
     * @return
     */
    List<JslOrderVo> selectJslOrderByUserId(Long userId,LocalDateTime addTime,Integer orderTotalStatus);

    /**
     * 查询全款订单
     * @param userId
     * @param addTime
     * @param orderTotalStatus
     * @return
     */
    List<JslOrderVo> selectTotalOrderByUserId(Long userId,LocalDateTime addTime,Integer orderTotalStatus);

    /**
     * 查询银行转账订单
     * @param userId
     * @param addTime
     * @param orderTotalStatus
     * @return
     */
    List<JslOrderVo> selectBankOrderByUserId(Long userId,LocalDateTime addTime,Integer orderTotalStatus);
    /**
     * selectJslOrderVoByUserIdForBank: 获取银行承兑的订单信息<br/>
     *
     * @param currentPage
     * @param pageSize
     * @param currentDate
     * @param userId
     * @return
     * @author Kai.Wang
     * @date 2021/11/24 16:51
     */
    PageInfo<?> selectJslOrderVoByUserIdForBank(Integer currentPage, Integer pageSize, LocalDateTime currentDate, Long userId);

    /**
     * selectJslOrderVoByUserIdAndOrderId: 根据当前用户的Id和订单Id查询订单详细信息<br/>
     *
     * @param orderId
     * @param userId
     * @return
     * @author Jason.Wang
     * @date 2021/12/26 11:56
     */
    JslOrderVo selectJslOrderVoByUserIdAndOrderId(String orderId, Long userId);

    /**
     * selectJslOrderVoByOrderId: 通过当前订单Id查询订单信息<br/>
     *
     * @param orderId
     * @return
     * @author Jason.Wang
     * @date 2021/12/29 0:40
     */
    JslOrderVo selectJslOrderVoByOrderId(String orderId);

    /**
     * updateOrderPayMentInfo: 更新当前订单的付款状态信息<br/>
     *
     * @param orderId
     * @param paySuccessDate
     * @param bankTrxId
     * @return
     * @author Jason.Wang
     * @date 2022/1/1 11:09
     */
    boolean updateOrderPayMentInfo(String orderId, LocalDateTime paySuccessDate, String bankTrxId) throws InterruptedException;

    /**
     * updateCancelOrderByOrderIdAndUserId: 取消当前订单信息<br/>
     *
     * @param reqCancelOrder
     * @param jslOrderVo
     * @return
     * @author Jason.Wang
     * @date 2022/1/1 22:49
     */
    boolean updateCancelOrderByOrderIdAndUserId(ReqCancelOrder reqCancelOrder, JslOrderVo jslOrderVo);

    /**
     * updateCancelOrderByOrderIdAndUserIdForApply: 申请退货退款<br/>
     *
     * @param jslOrderVo
     * @return
     * @author Jason.Wang
     * @date 2022/1/2 9:52
     */
    boolean updateCancelOrderByOrderIdAndUserIdForApply(JslOrderVo jslOrderVo);

    /**
     * @Description 订单确认收货
     * @Date 14:55 2022/1/3
     * @Param [jslOrderVo]
     * @return boolean
     * @Author M_
     **/
    void orderConfirmReceipt(ReqOrderConfirmReceipt reqOrderConfirmReceipt);

    /**
     * 分页获取用户订单信息
     * @param page
     * @param size
     * @param userId
     * @return
     */
    PageInfo<UserOrderPageVo> getUserOrderPage(int page,int size,Long userId,Long inviteId) ;

    public BigDecimal getJslTax();

    public int updateStatus(String orderId);

    public int updateOrderType(String orderId);

    /**
     * 关于支付完成后的发票操作
     * @param orderId
     * @param userId
     */
    public void aboutApply(String orderId,Long userId);

    /**
     * 创建账号一个月之内未下单
     */
    public List<JslOrder> selectJslOrderNearMonth(Long userId,LocalDateTime addTime);
}
